﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 窗体应用计算器
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void Calculate(object sender, EventArgs e)
        {
            double number1 = double.Parse(this.Num_1.Text);
            double number2 = double.Parse(this.Num_2.Text);
            
            char opt = Convert.ToChar(this.comboBox1.Text);

            switch(opt)
            {
                case '+':this.result.Text = (number1 + number2).ToString();break;
                case '-': this.result.Text = (number1 - number2).ToString(); break;
                case '*': this.result.Text = (number1 * number2).ToString(); break;
                case '/': this.result.Text = (number1 / number2).ToString(); break;
                case '%': this.result.Text = (number1 % number2).ToString(); break;
                default: break;

            }
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void Num_1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
